package com.dev.base;

import com.dev.pojo.Item;

/**
 * @author 戴 骥
 * @date 2021-08-22 14:22
 */
public class ConstructLambda {
    public static void main(String[] args) {
        ItemCreatorBlankConstruct construct = () -> new Item();
        Item item1 = construct.getItem();
        System.out.println("item1 = " + item1);
        ItemCreatorBlankConstruct construct2 = Item::new;
        System.out.println("construct2.getItem() = " + construct2.getItem());

        ItemCreatorParamContruct creatorParamContruct = (id, name, price) -> new Item();
        Item item = creatorParamContruct.getItem(1, "2", 1.2);
        System.out.println(item);
    }
}

@FunctionalInterface
interface ItemCreatorBlankConstruct {
    Item getItem();
}

@FunctionalInterface
interface ItemCreatorParamContruct {
    Item getItem(int id, String name, double price);
}